package android.slc.appbase.ui.vd;

import android.content.Context;
import android.view.View;

import androidx.activity.result.ActivityResultCaller;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;

/**
 * 基础的详细盒子vm
 *
 * @author slc
 * @date 2020-08-25 16:13
 */
public class BaseAppVd<VB extends BaseAppVmBox> implements DefaultLifecycleObserver {
    protected ActivityResultCaller activityResultCaller;
    protected LifecycleOwner lifecycleOwner;
    protected Context context;
    protected View contentView;
    protected VB vmBox;

    public void init(ActivityResultCaller activityResultCaller, View contentView, VB vmBox) {
        this.activityResultCaller = activityResultCaller;
        this.lifecycleOwner = (LifecycleOwner) activityResultCaller;
        this.contentView = contentView;
        this.context = contentView.getContext();
        this.vmBox = vmBox;
        this.lifecycleOwner.getLifecycle().addObserver(this);
        initView();
        initMustCondition();
    }

    protected void initView() {

    }

    protected void initMustCondition() {

    }

}
